package com.personal.website.lottery.web.controller.admin;

import com.personal.website.lottery.web.model.Article;
import com.personal.website.lottery.web.service.ArticleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by 10171225 on 2016/6/24.
 */
@Controller
@RequestMapping("/admin/articleManage")
public class ArticleManage {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Resource
    private ArticleService articleService;

    @RequestMapping("/allArticles")
    public String allArticles(Model model) {
        List<Article> articles = this.articleService.getArticles(50);
        model.addAttribute("articles", articles);
        return "admin/articleManage/articles";
    }

    @RequestMapping("/reviewedArticles")
    public String reviewedArticles(Model model) {
        List<Article> articles = this.articleService.getReviewedArticles(50);
        model.addAttribute("articles", articles);
        return "admin/articleManage/articles";
    }

    @RequestMapping("/unReviewedArticles")
    public String unReviewedArticles(Model model) {
        List<Article> articles = this.articleService.getUnReviewedArticles(50);
        model.addAttribute("articles", articles);
        return "admin/articleManage/articles";
    }
}
